using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Publicuse.Application;
using Publicuse.Autofac;
using Publicuse.Entity;
using Publicuse.Interface;
using Publicuse.Interface.Extend;
using Geekeradmin.Authorize;

namespace Geekeradmin.Controllers
{
    /// <summary>
    /// 数据统计模块
    /// </summary>
    [UserAuthorize("Admin")]
    public class StatisticsController : BaseController
    {
        public StatisticsController(
            IAutofaceInstance autoface,
            IMySqlSugarService mySqlSugar,
            IWebHostEnvironment webHost,
            IOptions<DBConnectionOption> options,
            IBaseServiceExt baseServiceExt
        )
            : base(autoface, mySqlSugar, webHost, options, baseServiceExt) { }

        /// <summary>
        /// 操作柱形访问量（统计新增、删除、修改、导入操作记录数）
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetList"), AllowAnonymous]
        public async Task<JsonResult> GetOperate()
        {
            CommonResult result = await StatisticsApplication
                .GetApplication(this.container)
                .GetOperate();
            return new JsonResult(result);
        }

        /// <summary>
        /// 模块综合访问量(模块对应的新增、删除、修改、导入)
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetListb"), AllowAnonymous]
        public async Task<JsonResult> GetWebsitetraffic()
        {
            CommonResult result = await StatisticsApplication
                .GetApplication(this.container)
                .GetWebsitetraffic();
            return new JsonResult(result);
        }

        /// <summary>
        /// 模块扇形访问量
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetListc"), AllowAnonymous]
        public async Task<JsonResult> GetCurrenttraffic()
        {
            CommonResult result = await StatisticsApplication
                .GetApplication(this.container)
                .GetCurrenttraffic();
            return new JsonResult(result);
        }

        /// <summary>
        /// 模块雷达访问量
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetListd"), AllowAnonymous]
        public async Task<JsonResult> GetRadartraffic()
        {
            CommonResult result = await StatisticsApplication
                .GetApplication(this.container)
                .GetRadartraffic();
            return new JsonResult(result);
        }

        /// <summary>
        /// 登录时间表
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetListe"), AllowAnonymous]
        public async Task<JsonResult> GetLoginSchedule()
        {
            CommonResult result = await StatisticsApplication
                .GetApplication(this.container)
                .GetLoginSchedule();
            return new JsonResult(result);
        }
    }
}
